﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebUI.constant;

namespace WebUI.dto
{
    /// <summary>
    /// 一般数据传输对象
    /// </summary>
    /// <typeparam name="T">一般数据对象</typeparam>
    public class Result<T>
    {
        public CodeEnum Code;//状态码

        internal void Build(CodeEnum eRROR_404, object codeDirctionaty)
        {
            throw new NotImplementedException();
        }

        public String Message;//反馈消息
        public T Data;//数据
        public bool IsOk;//是否成功


        /// <summary>
        /// 数据工厂
        /// </summary>
        /// <param name="code">状态码</param>
        /// <param name="msg">反馈消息</param>
        /// <param name="data">一般数据</param>
        /// <param name="isOK">是否成功</param>
        /// <returns></returns>
        public static Result<T> Build(CodeEnum code,String msg,T data,bool isOK)
        {
            Result<T> result = new Result<T>
            {
                Code = code,
                Message = msg,
                Data = data,
                IsOk = isOK
            };
            return result;
        }
    }
}